package cn.itcast;


import cn.itcast.feign.client.UserClient;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;


@MapperScan("cn.itcast.order.mapper")
@SpringBootApplication
//@EnableFeignClients//开启feign获取远方连接只能扫描到同包下得--如果不同包需要指定
//@EnableFeignClients(basePackages = "cn.itcast.feign.client")//指定开启feign要扫描的包//
@EnableFeignClients(clients = {UserClient.class})//指定要被扫描的客户端字节码
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    //注册客户端==用于服务器间相互反问
    //    @LoadBalanced//负载均衡
    @Bean//注册bean对象
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

//    //实现自定义负载均衡策略==默认为服务器间轮询启动=
//    @Bean
//    public IRule randomRule(){
//        return new RandomRule();
//    }
}